#创建一个文件 filename:文件名称 type 写入类型  writeContent:写入内容，支持str和list,encoding 字符编码
def createNewFile(filename='default',type='a',writeContent='default',encoding='UTF-8'):
	filePath='./'+filename+'.py';
	fileObj=open(filePath,type,encoding=encoding);
	if isinstance(writeContent,str):
		fileObj.write('#'+writeContent+'\n');
	else:
		fileObj.writelines(writeContent);
	fileObj.close();


writeContent='#文件管理系统\n';
createNewFile('fileManage','w',writeContent);

##复制一个文件：source：源文件，target；目标文件,writeType:写入模式，默认覆盖，encoding:编码,basePath:基本路径
def copyOnefile(source='source',target='target',copyType=0,encoding='UTF-8'):
	readPath='F:/python/练习/'+source+'.py';
	writePath='./'+target+'.py';
	if copyType==0:
		readObj=open(readPath,'r',encoding=encoding);
		writeObj=open(writePath,'w',encoding=encoding);
	elif copyType==1:
		readObj=open(readPath,'rb',encoding=encoding);
		writeObj=open(writePath,'wb',encoding=encoding);
	content=readObj.readline();
	while len(content)>0:
		writeObj.write(content);
		content=readObj.readline();		
	else:
		readObj.close();
		writeObj.close();
#copyOnefile('a','b');